import React from 'react';
//1. 引入 Route, BrowserRouter组件  <nav>
import {Route, BrowserRouter, NavLink} from 'react-router-dom';
import Duanzi from './components/Duanzi';
import Weather from './components/Weather';
import YiYan from './components/YiYan';
import "./App.css";

//创建根组件 App
export default class App extends React.Component{
    render(){
        return <div>
            <BrowserRouter>
                <NavLink to="/duanzi" >段子</NavLink>&nbsp;&nbsp;
                <NavLink to="/wea" >天气</NavLink>&nbsp;&nbsp;
                <NavLink to="/yiyan">名言</NavLink>&nbsp;&nbsp;
                <hr />
            
                {/* 2. 添加路由规则 */}
                <Route path="/duanzi" component={Duanzi} />
                <Route path="/wea" component={Weather} />
                <Route path="/yiyan" component={YiYan} />
            </BrowserRouter>
        </div>
    }
}
